<?php
/*
Template Name: Profil - Modification
*/
?>
<?php get_header() ?>
<?php if($_GET['edit'] == "ok") {
	require_once(TEMPLATEPATH."/modification.php");}
	if ($_GET['id']){
		$userid =htmlspecialchars($_GET['id']);
	}
	else {
		$userid = get_current_user_id();
	}
	$user = get_user_meta($userid);
	$wpuser= get_userdata($userid);
	//var_dump($user);
	//var_dump($wpuser);
?>


<div class="middle-highlight-container">
  <div class="middle">
    <h2 class="page-subtitle-profil"><?php if($user['first_name'][0] != "") :
	        	echo $user['first_name'][0].' '.$user['last_name'][0];
	        	else : echo "Modification Profil";
	        	endif; ?> </h2>
  </div>
</div>

<?php $userid = get_current_user_id() ?>
<div id="content-container">
	<?php  get_sidebar(); ?>

    <?php the_post()?>
    <div id="post-<?php the_ID(); ?>" class="post">
      <div class="post-content">

  		<form action="?edit=ok" method="post">
	        <?php the_content()?>

	        <div class="profil_avatar">
				<?php if($user['simple_local_avatar'][0]!='') : echo get_avatar($userid);
				   else : echo '<img id="test" src="'. get_bloginfo('template_url'). '/images/profil.png"/>';
				  endif;?>
        	</div>

        	<div class="modif_profil_titre_page">Modification du Profil</div>


			<div class="modif_profil_bloc_pers">

				<div class="formulaire">
					<table border="0" cellspacing="0" cellpadding="0" width="100%">
						<tr>
						<td></td>
							<td><div class="modif_profil_titre_bloc"> Informations personnelles </div></td>
						</tr>
						<tr>
							<td> Pr&eacutenom : </td>
							<input type="hidden" name="numero" value="<?php echo $userid ?>"/>
							<td><input type="text" name="firstnameB" disabled="true" value="<?php echo $user['first_name'][0] ?>"/></td>
							<input type="hidden" name="firstname" value="<?php echo $user['first_name'][0] ?>"/>
						</tr>

						<tr>
							<td> Nom : </td>
							<td><input type="text" name="lastnameB" disabled="true" value="<?php echo $user['last_name'][0] ?>"/></td>
							<input type="hidden" name="lastname" value="<?php echo $user['last_name'][0] ?>"/>
						</tr>
						<tr>
							<td> Email : </td>
							<td><input type="text" name="user_mail" value="<?php echo $wpuser->user_email ?>"/></td>
						</tr>
						<tr>
							<td> T&eacutel&eacutephone : </td>
							<td><input type="text" name="user_tel" value="<?php echo $user['tel'][0] ?>"/></td>
						</tr>
						<tr>
							<td> Date de naissance : </td>
							<td><input type="text" name="user_naissance" value="<?php echo $user['date_naissance'][0] ?>"/></td>
						</tr>
						<tr>
			        		<td> Promotion : </td>
			 				<td><input type="text" name="promo" value="<?php echo $user['promo'][0]?>" size="10" maxlength="40"/></td>
						</tr>
						<tr>
			        		<td> Formation : </td>
			 				<td><input type="text" name="formation" value="<?php echo $user['formation'][0]?>" size="10" maxlength="40"/></td>
						</tr>
						<tr>
			        		<td> Statut : </td>
			  				<td><input type="text" name="statut" value="<?php echo $user['statut'][0]?>" size="10" maxlength="40"/></td>
						</tr>
						<tr>
			       			<td> Site internet : </td>
			       			<td><input type="text" name="user_url" value="<?php echo $wpuser->user_url?>" size="10" maxlength="40"/></td>
						</tr>

				<tr>
					<td></td>
					<td><div class="modif_profil_titre_bloc"> Informations professionnelles </div></td>
	       		</tr>
	       		<tr>
		       		<td> Viadeo : </td>
		       		<td><input type="text" name="viadeo" value="<?php echo $user['viadeo'][0]?>" size="10" maxlength="40"/></td>
		       	</tr>
	       		<tr>
		       		<td> LinkedlIn : </td>
		       		<td><input type="text" name="linkedin" value="<?php echo $user['linkedin'][0]?>" size="10" maxlength="40"/></td>
				</tr>
				<tr>
		       		 <td> Entreprise actuelle : </td>
		       		 <td><input type="text" name="ent_actuelle" value="<?php echo $user['ent_actuelle'][0]?>" size="10" maxlength="40"/></td>
		        </tr>
				<tr>
		       		 <td> Descriptif : </td>
		       		 <td><input type="text" name="desc_ent" value="<?php echo $user['desc_ent'][0]?>" size="10" maxlength="40"/></td>
		        </tr>
				<tr>
		       		 <td> Poste : </td>
		       		 <td><input type="text" name="poste" value="<?php echo $user['poste'][0]?>" size="10" maxlength="40"/></td>
		        </tr>
				<tr>
		       		 <td> Mission : </td>
		       		 <td><input type="text" name="mission" value="<?php echo $user['mission'][0]?>" size="10" maxlength="40"/></td>
		        </tr>
		        <tr>
		        	<td></td>
		        	<td><input type="submit" name="modifier" value="Modifier"/></td>
	        	</tr>
	        </table>
	        </div>
	        </div>

        </form>

</div>
</div>


</div><!-- #content-container -->

<?php get_footer() ?>